package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.ExtGpsMapper;
import com.ruoyi.bizsys.domain.ExtGps;
import com.ruoyi.bizsys.service.IExtGpsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * Gps记录Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class ExtGpsServiceImpl extends ServiceImpl<ExtGpsMapper,ExtGps> implements IExtGpsService {

    /**
     * 查询Gps记录
     *
     * @param id Gps记录ID
     * @return Gps记录
     */
    @Override
    public ExtGps selectExtGpsById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询Gps记录列表
     *
     * @param extGps Gps记录
     * @return Gps记录
     */
    @Override
    public List<ExtGps> selectExtGpsList(ExtGps extGps) {
        return this.list(new QueryWrapper<>(extGps).last("order by id desc"));
    }

    /**
     * 新增Gps记录
     *
     * @param extGps Gps记录
     * @return 结果
     */
            @Override
    public int insertExtGps(ExtGps extGps) {
                                                                                                                                                                                                                                                                extGps.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(extGps);
    }

    /**
     * 修改Gps记录
     *
     * @param extGps Gps记录
     * @return 结果
     */
            @Override
    public int updateExtGps(ExtGps extGps) {
                                                                                                                                                                                                                                                                                                        extGps.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(extGps);
    }

    /**
     * 批量删除Gps记录
     *
     * @param ids 需要删除的Gps记录ID
     * @return 结果
     */
            @Override
    public int deleteExtGpsByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除Gps记录信息
     *
     * @param id Gps记录ID
     * @return 结果
     */
    @Override
    public int deleteExtGpsById(Long id) {
        return baseMapper.deleteById(id);
    }

}
